*---------------------------------------------SUMMARY_STATS.DO-----------------------------------------
*This script produces summary statistic information on Ann Arbor sales according to whether properties
*had high or low capped TV benefits.

*Sebastien Bradley 10/27/10

clear all
capture cd "C:/Users/Sebastien/Documents/Research/PropertyTaxes/Ann_Arbor/AA_proptaxdata19972008"
set matsize 600
capture log close
set more off

log using summary_stats.txt, text replace

use tax_cap_est_data.dta
drop if saleyear==2008

*------------------------------------------------------------------------------------------------------------------------------------------------------
*Compute tax benefit associated with inheriting capped TV for the year in which sale occurs
local av = "sev"
local indep = "d_tax"
local se = "cluster neighborhood"

gen tvcapval = (`av'-tv)*mills*d	/*Pro-rated*/
gen d_tax = (`av'-tv)*mills		/*Full-year capped TV tax benefit*/
*------------------------------------------------------------------------------------------------------------------------------------------------------

gen `indep'_pct = `indep'/sev

*Identify high-vs.-low relative capped TV benefits in each year (otherwise just picking up year effects):
bysort saleyear: egen med_`indep'_pct = median(`indep'_pct)
gen I_high_savings = (`indep'_pct>=med_`indep'_pct) if `indep'_pct~=.
label define hilo 0 "Low (SEV-TV)/SEV" 1 "High (SEV-TV)/SEV"
label values I_high_savings hilo


*Tabulate housing characteristics by high-vs.-low capped TV benefits and perform tests of equal means and medians:
*USED TO PRODUCE TABLE 1 OF RESTAT R&R:
local vlist = "resfloorarea resgaragearea resnumbed resfullbaths reshalfbaths resyearbuilt actualage renovage yearsheld sev tv tvcapval saleamt d"
foreach v of varlist `vlist' {
	disp ""
	disp upper("`v'")
	table I_high_savings, c(mean `v' med `v' count `v')
}

foreach v of varlist `vlist' {
	disp ""
	disp upper("`v'")
	median `v', by(I_high_savings)	/*Pearson test of equal medians*/
}

foreach v of varlist `vlist' {
	disp ""
	disp upper("`v'")
	ttest `v', by(I_high_savings)		/*t test of equal means*/
}

log close
/**/
